Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix numpy API deprecations np.trapz -> np.trapezoid #81

Closed
wants to merge 3 commits into from

Conversation

xgarrido
Copy link
Collaborator

@xgarrido xgarrido commented Jul 5, 2024

No description provided.

@xgarrido
Copy link
Collaborator Author

xgarrido commented Jul 5, 2024

This fails for python 3.9 and numpy < 2.0. So the fix is maybe a bit early. Can imagine to have this

if np.__version__ >= "2.0.0":
  from numpy import trapezoid as trapz
else:
  from numpy import trapz

@sgiardie
Copy link
Collaborator

sgiardie commented Jul 5, 2024

This fails for python 3.9 and numpy < 2.0. So the fix is maybe a bit early. Can imagine to have this

if np.__version__ >= "2.0.0":
  from numpy import trapezoid as trapz
else:
  from numpy import trapz

Hi @xgarrido, I was also about to write that it is too early for this substitution. For example, I have issues with numpy >= 2.0 since some packages like tensorflow (required by cosmopower) require numpy < 2.
I implemented your suggestion!

@xgarrido
Copy link
Collaborator Author

xgarrido commented Jul 5, 2024

You need to change the call np.trapz to only trapz

@codecov-commenter
Copy link

codecov-commenter commented Jul 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (master@660e0fa). Learn more about missing BASE report.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #81   +/-   ##
=========================================
  Coverage          ?   87.53%           
=========================================
  Files             ?        3           
  Lines             ?      393           
  Branches          ?        0           
=========================================
  Hits              ?      344           
  Misses            ?       49           
  Partials          ?        0           
Files Coverage Δ
mflike/mflike.py 90.15% <ø> (ø)
mflike/theoryforge.py 85.49% <100.00%> (ø)

cmbant added a commit that referenced this pull request Aug 2, 2024
@cmbant
Copy link
Collaborator

cmbant commented Sep 4, 2024

Should have been merged with #90

@cmbant cmbant closed this Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants